-
Notifications
You must be signed in to change notification settings - Fork 60
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fast-generic-serializer supports 'enum' and 'fixed' types #515
fast-generic-serializer supports 'enum' and 'fixed' types #515
Conversation
with enum and fixed fields. For now marked as ignored e.g. due to: class com.linkedin.avro.fastserde.generated.avro.JustSimpleEnum cannot be cast to class org.apache.avro.generic.GenericData$EnumSymbol
with 'enum' and 'fixed' types.
Codecov ReportPatch and project coverage have no change.
Additional details and impacted files@@ Coverage Diff @@
## master #515 +/- ##
=========================================
Coverage 45.82% 45.83%
- Complexity 4441 4442 +1
=========================================
Files 398 398
Lines 28040 28040
Branches 4622 4622
=========================================
+ Hits 12850 12851 +1
Misses 13634 13634
+ Partials 1556 1555 -1 ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi, thanks a lot for this contribution!
The main change LGTM, but I have a concern about one of the "cleanups" in the first comment... can you elaborate on that one?
ifBlock = ifBlock != null ? ifBlock._elseif(condition) : body._if(condition); | ||
ifBlock = body._if(condition); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is the rationale for this change?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's consider two key facts:
- For the first time we enter this block
ifBlock
isnull
- The block can be entered at most once due to
break
at the end.
It means condition ifBlock != null
is always false
.
"Always" in this context means "at most once".
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see. That's right... I missed that detail when I refactored this code in 608bce8
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
ifBlock = ifBlock != null ? ifBlock._elseif(condition) : body._if(condition); | ||
ifBlock = body._if(condition); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see. That's right... I missed that detail when I refactored this code in 608bce8
PR aims to fix scenario when fast-generic-serializer serializes specific record with fields of type 'enum' and/or 'fixed'.
The 4th commit it the most important one and its message (
[fast-avro] Now fast-generic-serializer supports records with 'enum' and 'fixed' types.
) might be used after squash.1st and 2nd commit are self-explanatory, just to avoid pollution of the main commit.
Other commits were pushed just to present differences in the generated code.
Example stacktrace before: